package com.home.work.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * 2019-08-27 22:38
 *
 * @author LCY
 */
@WebFilter(filterName = "UrlFilter")
public class UrlFilter implements Filter {
    @Override
    public void destroy() {
    }
    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        // a,b,c
        // 处理req
        String uri = ((HttpServletRequest) req).getRequestURI();
        String[] split = uri.split( "/" );
        String controllerRequestMapping = split[1];
        String methodRequestMapping = split[2];

        chain.doFilter( req, resp );

        // 处理resp
    }
    @Override
    public void init(FilterConfig config) throws ServletException {

    }

}
